using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

public class CryptedFileSaver
{
	public static bool IsFileExists(string path)
	{
		return File.Exists(path);
	}

	public static void SaveFileAes(string path, object objectToSave)
	{
	}

	public static T LoadFileAes<T>(string path)
	{
		return default(T);
	}

	public static void SaveFileWithBinaryFormater(string path, object objectToSave)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		FileStream fileStream = File.Create(path);
		binaryFormatter.Serialize(fileStream, objectToSave);
		fileStream.Close();
	}

	public static T LoadFileWithBinaryFormater<T>(string path) where T : class
	{
		try
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			FileStream fileStream = File.Open(path, FileMode.Open);
			T result = binaryFormatter.Deserialize(fileStream) as T;
			fileStream.Close();
			return result;
		}
		catch
		{
			return (T)null;
		}
	}
}
